home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 111 / PC Guia 111.iso / Software / Utils / HJTHotkey 2.7.4 / HJTHotkey.exe / {app} / Include in HJTHotkey.ahk < prev    next >
Encoding:
Text File  |  2004-09-14  |  5.1 KB  |  269 lines

  1. return
  2.  
  3. customisehotkeys:
  4.  
  5. start2:
  6. showagain:
  7.  
  8. gosub, readhotkeys
  9.  
  10. ControlGetPos, X, Y, Width, Height, SysListView321, Program Manager
  11.  
  12. Width/=2
  13. Height/=2
  14.  
  15. Height-=110
  16. Width-=293
  17.  
  18. Gui, Show, x%Width% y%Height% h240 w585 , HJTHotkey - Customise Hotkeys
  19.  
  20.  
  21. IniRead, key1, keys.ini, key1, Hotkeys
  22. IniRead, key2, keys.ini, key2, Secondkeys
  23.  
  24. winwait, HJTHotkey
  25.  
  26. i=1
  27.  
  28.  
  29. Loop, parse, Key1, `,
  30. {
  31.  
  32. if i=1
  33. Control, ChooseString, %A_Loopfield%, Combobox1, HJTHotkey
  34.  
  35. if i=2
  36. Control, ChooseString, %A_Loopfield%, Combobox2, HJTHotkey
  37.  
  38. if i=3
  39. Control, ChooseString, %A_Loopfield%, Combobox3, HJTHotkey
  40.  
  41. if i=4
  42. Control, ChooseString, %A_Loopfield%, Combobox4, HJTHotkey
  43.  
  44.  
  45. if i=5
  46. Control, ChooseString, %A_Loopfield%, Combobox5, HJTHotkey
  47.  
  48.  
  49. if i=6
  50. Control, ChooseString, %A_Loopfield%, Combobox6, HJTHotkey
  51.  
  52. if i=7
  53. Control, ChooseString, %A_Loopfield%, Combobox7, HJTHotkey
  54.  
  55.  
  56. if i=8
  57. Control, ChooseString, %A_Loopfield%, Combobox8, HJTHotkey
  58.  
  59. if i=9
  60. Control, ChooseString, %A_Loopfield%, Combobox9, HJTHotkey
  61.  
  62.  
  63. i++
  64.  
  65. }
  66.  
  67.  
  68. IniRead, key2, keys.ini, key2, Secondkeys
  69.  
  70. SetControlDelay,30
  71.  
  72. i=1
  73.  
  74. Loop, parse, Key2, `,
  75. {
  76.  
  77. if i=1
  78. ControlSetText, Edit1, %A_Backspace%%A_Loopfield%, HJTHotkey
  79.  
  80. if i=2
  81. ControlSetText, Edit2, %A_Backspace%%A_Loopfield%, HJTHotkey
  82.  
  83. if i=3
  84. ControlSetText, Edit3, %A_Backspace%%A_Loopfield%, HJTHotkey
  85.  
  86. if i=4
  87. ControlSetText, Edit4, %A_Backspace%%A_Loopfield%, HJTHotkey
  88.  
  89.  
  90.  
  91. if i=5
  92. ControlSetText, Edit5, %A_Backspace%%A_Loopfield%, HJTHotkey
  93.  
  94. if i=6
  95. ControlSetText, Edit6, %A_Backspace%%A_Loopfield%, HJTHotkey
  96.  
  97. if i=7
  98. ControlSetText, Edit7, %A_Backspace%%A_Loopfield%, HJTHotkey
  99.  
  100. if i=8
  101. ControlSetText, Edit8, %A_Backspace%%A_Loopfield%, HJTHotkey
  102.  
  103. if i=9
  104. ControlSetText, Edit9, %A_Backspace%%A_Loopfield%, HJTHotkey
  105.  
  106. i++
  107.  
  108. }
  109.  
  110. Return
  111.  
  112. Submit:
  113.  
  114. Gui, submit
  115. ;Gui, cancel
  116.  
  117.  
  118. instruct=Google=%google1%%google2%`nSysinfo(bho)=%sysinfob1%%sysinfob2%`nSysinfo(startup)=%sysinfos1%%sysinfos2%`nProcesses=%process1%%process2%`nBHO=%bho1%%bho2%`nToolbar=%toolbar1%%toolbar2%`nCWS=%cws1%%cws2%`nIEClose=%ie1%%ie2%`nNotepad=%notepad1%%notepad2%
  119.  
  120. Hotkeys=%google1%,%sysinfob1%,%sysinfos1%,%process1%,%bho1%,%toolbar1%,%cws1%,%ie1%,%notepad1%
  121.  
  122. Secondkeys=%google2%,%sysinfob2%,%sysinfos2%,%process2%,%bho2%,%toolbar2%,%cws2%,%ie2%,%notepad2%
  123.  
  124.  
  125. AllHotkeys=%google1%%google2%,%sysinfob1%%sysinfob2%,%sysinfos1%%sysinfos2%,%process1%%process2%,%bho1%%bho2%,%toolbar1%%toolbar2%,%cws1%%cws2%,%ie1%%ie2%,%notepad1%%notepad2%
  126.  
  127. IniWrite, %Hotkeys%, keys.ini, key1, Hotkeys
  128. IniWrite, %Secondkeys%, keys.ini, key2, Secondkeys
  129.  
  130. i=0
  131.  
  132. Loop, parse, Hotkeys, `,
  133. {
  134.  
  135. i++
  136.  
  137. if A_LoopField=Ctrl
  138. StringReplace,keys,A_LoopField,Ctrl,^, all
  139.  
  140. if A_LoopField=Alt
  141. StringReplace,keys,A_LoopField,Alt,!, all
  142.  
  143. if A_LoopField=Win
  144. StringReplace,keys,A_LoopField,Win,#, all
  145.  
  146. if A_LoopField=MClick
  147. StringReplace,keys,A_LoopField,MClick,~Mbutton &%a_space%, all
  148.  
  149. if A_LoopField=LClick
  150. StringReplace,keys,A_LoopField,LClick,~Lbutton &%a_space%, all
  151.  
  152.  
  153. if i=1
  154. google1=%keys%
  155.  
  156. if i=2
  157. sysinfob1=%keys%
  158.  
  159. if i=3
  160. sysinfos1=%keys%
  161.  
  162. if i=4
  163. process1=%keys%
  164.  
  165. if i=5
  166. bho1=%keys%
  167.  
  168. if i=6
  169. toolbar1=%keys%
  170.  
  171. if i=7
  172. cws1=%keys%
  173.  
  174. if i=8
  175. ie1=%keys%
  176.  
  177. if i=9
  178. notepad1=%keys%
  179.  
  180. }
  181.  
  182. Loop, parse, Secondkeys, `,
  183. {
  184. StringLen, Number, A_Loopfield
  185.  
  186. if Number>1
  187. {
  188. msgbox, "%A_Loopfield%" is an invalid hotkey.`nHotkeys must only have one letter in them.`n`nPlease try again.
  189. goto, start2
  190. }
  191.  
  192. }
  193.  
  194. a=0
  195. b=0
  196.  
  197. Loop, parse, AllHotkeys, `,
  198. {
  199. a++
  200. key=%A_Loopfield%
  201.  
  202. Loop, parse, AllHotkeys, `,
  203. {
  204.  
  205. if a<>%a_index%
  206. {
  207. if A_Loopfield=%key%
  208. {
  209. msgbox, "%A_Loopfield%" is an invalid hotkey.`nHotkeys cannot be specified twice.`n`nPlease try again.
  210. goto, start2
  211. }
  212. }
  213.  
  214. }
  215.  
  216. }
  217.  
  218.  
  219.  
  220. ini=[Hotkeys]`nGoogle=%google1%%google2%`nSysinfo(bho)=%sysinfob1%%sysinfob2%`nSysinfo(startup)=%sysinfos1%%sysinfos2%`nProcesses=%process1%%process2%`nBHO=%bho1%%bho2%`nToolbar=%toolbar1%%toolbar2%`nCWS=%cws1%%cws2%`nIEClose=%ie1%%ie2%`nNotepad=%notepad1%%notepad2%
  221.  
  222. ifexist, hotkeys.ini
  223. filedelete,hotkeys.ini
  224. fileappend,%ini%,hotkeys.ini
  225.  
  226. gosub, readhotkeys
  227.  
  228. reload
  229.  
  230. readhotkeys:
  231.  
  232. IniRead, G, hotkeys.ini, Hotkeys, Google, ^g
  233. IniRead, SB, hotkeys.ini, Hotkeys, Sysinfo(bho),^b
  234. IniRead, SS, hotkeys.ini, Hotkeys, Sysinfo(startup), ^s
  235. IniRead, P, hotkeys.ini, Hotkeys, processes, !a
  236. IniRead, B, hotkeys.ini, Hotkeys, BHO, !b
  237. IniRead, T, hotkeys.ini, Hotkeys, Toolbar, !t
  238. IniRead, C, hotkeys.ini, Hotkeys, CWS , !c
  239. IniRead, IE, hotkeys.ini, Hotkeys, IEClose, ^z
  240. IniRead, N, hotkeys.ini, Hotkeys, Notepad , ^n
  241.  
  242. Hotkey,%G%, Google
  243. hotkey,%SB%,Sysinfo(bho)
  244. hotkey,%SS%,Sysinfo(startup)
  245. hotkey,%P%, processes
  246. hotkey,%B%, BHO
  247. hotkey,%T%, Toolbar
  248. hotkey,%C%, CWS
  249. hotkey,%IE%,IEClose
  250. hotkey,%N%, Notepad
  251.  
  252. return
  253.  
  254. Cancel:
  255. gui, cancel
  256. exit
  257. return
  258.  
  259. Defaults:
  260. filedelete,hotkeys.ini
  261. fileappend,[Hotkeys]`nGoogle=^g`nSysinfo(bho)=^b`nSysinfo(startup)=^s`nProcesses=!a`nBHO=!b`nToolbar=!t`nCWS=!c`nIEClose=^z`nNotepad=^n`n,hotkeys.ini
  262.  
  263.  
  264. filedelete,keys.ini
  265. fileappend,[key1]`nHotkeys=Ctrl`,Ctrl`,Ctrl`,Alt`,Alt`,Alt`,Alt`,Ctrl`,Ctrl`n`n[key2]`nSecondkeys=g`,b`,s`,a`,b`,t`,c`,z`,n, keys.ini
  266.  
  267. goto, showagain
  268.  
  269. return